
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Apple devices fullscreen -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Apple devices fullscreen -->
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link href="../css/main.css?v=12u234y" rel="stylesheet" type="text/css">
<link href="../css/page.css" rel="stylesheet" type="text/css">
<link href="../font/css/font-awesome.min.css" rel="stylesheet" />
<!--[if IE 7]>
  <link rel="stylesheet" href="../font/css/font-awesome-ie7.min.css">
<![endif]-->
<link href="../js/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<link href="../js/perfect-scrollbar.min.css" rel="stylesheet" type="text/css"/>
<style type="text/css">html, body { overflow: visible;}</style>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="../js/layer/layer.js"></script><!-- 弹窗js 参考文档 http://layer.layui.com/-->
<script type="text/javascript" src="../js/admin.js"></script>
<script type="text/javascript" src="../js/flexigrid.js"></script>
<script type="text/javascript" src="../js/jquery.validation.min.js"></script>
<script type="text/javascript" src="../js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="../js/jquery.mousewheel.js"></script>
<script src="../js/myFormValidate.js"></script>
<script src="../js/myAjax2.js"></script>
<script src="../js/global.js"></script>
<script type="text/javascript">
function delfunc(obj){
	layer.confirm('确认删除？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			$.ajax({
				type : 'post',
				url : $(obj).attr('data-url'),
				data : {act:'del',del_id:$(obj).attr('data-id')},
				dataType : 'json',
				success : function(data){
					if(data==1){
						layer.msg('操作成功', {icon: 1});
						$(obj).parent().parent().parent().remove();
					}else{
						layer.msg(data, {icon: 2,time: 2000});
					}
				}
			})
		}, function(index){
			layer.close(index);
			return false;// 取消
		}
	);
}

function delAll(obj,name){
	var a = [];
	$('input[name*='+name+']').each(function(i,o){
		if($(o).is(':checked')){
			a.push($(o).val());
		}
	})
	if(a.length == 0){
		layer.alert('请选择删除项', {icon: 2});
		return;
	}
	layer.confirm('确认删除？', {btn: ['确定','取消'] }, function(){
			$.ajax({
				type : 'get',
				url : $(obj).attr('data-url'),
				data : {act:'del',del_id:a},
				dataType : 'json',
				success : function(data){
					if(data == 1){
						layer.msg('操作成功', {icon: 1});
						$('input[name*='+name+']').each(function(i,o){
							if($(o).is(':checked')){
								$(o).parent().parent().remove();
							}
						})
					}else{
						layer.msg(data, {icon: 2,time: 2000});
					}
					layer.closeAll();
				}
			})
		}, function(index){
			layer.close(index);
			return false;// 取消
		}
	);	
}

//表格列表全选反选
$(document).ready(function(){
	$('.hDivBox .sign').click(function(){
	    var sign = $('#flexigrid > table>tbody>tr');
	   if($(this).parent().hasClass('trSelected')){
	       sign.each(function(){
	           $(this).removeClass('trSelected');
	       });
	       $(this).parent().removeClass('trSelected');
	   }else{
	       sign.each(function(){
	           $(this).addClass('trSelected');
	       });
	       $(this).parent().addClass('trSelected');
	   }
	})
});

//获取选中项
function getSelected(){
	var selectobj = $('.trSelected');
	var selectval = [];
    if(selectobj.length > 0){
        selectobj.each(function(){
        	selectval.push($(this).attr('data-id'));
        });
    }
    return selectval;
}
</script>
</head>
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
	<div class="fixed-bar">
		<div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
			<div class="subject">
				<h3>权限管理 - 管理角色</h3>
				<h5>网站系统角色管理</h5>
			</div>
		</div>
	</div>
	<form class="form-horizontal" action="/index.php/Admin/Admin/roleSave.html" id="roleform" method="post">
		<input type="hidden" name="role_id" value="" />
		<div class="ncap-form-default">
			<dl class="row">
				<dt class="tit">
					<label for="role_name"><em>*</em>角色名称</label>
				</dt>
				<dd class="opt">
					<input type="text" name="data[role_name]" id="role_name" value="" class="input-txt">
					<span class="err" id="name_err" style="display: none">导航名称不能为空!!</span>
					<p class="notic"></p>
				</dd>
			</dl>
			<dl class="row">
				<dt class="tit">
					<label for="role_desc"><em>*</em>角色描述</label>
				</dt>
				<dd class="opt">
					<textarea id="role_desc" name="data[role_desc]" class="tarea" rows="6"></textarea>
					<span class="err" id="err_tpl_content" style="display:none;">短信内容不能为空</span>
					<p class="notic"></p>
				</dd>
			</dl>
			<dl class="row">
				<dt class="tit">
					<label for="cls_full">权限分配</label>
				</dt>
				<dd style="margin-left:200px;">
					<div class="ncap-account-container" style="border-top:none;">
						<h4>
							<input id="cls_full" onclick="choosebox(this)" type="checkbox">
							<label>全选</label>
						</h4>
					</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>内容管理</label>
								<input value="1" cka="mod-content" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="1"  ck="mod-content" type="checkbox">广告列表</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="2"  ck="mod-content" type="checkbox">广告位管理</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="12"  ck="mod-content" type="checkbox">文章列表(文章管理)</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="13"  ck="mod-content" type="checkbox">文章分类</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="14"  ck="mod-content" type="checkbox">专题列表</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>系统设置</label>
								<input value="1" cka="mod-system" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="3"  ck="mod-system" type="checkbox">商城设置</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="4"  ck="mod-system" type="checkbox">自定义导航栏</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="5"  ck="mod-system" type="checkbox">短信模板</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="6"  ck="mod-system" type="checkbox">友情链接</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="7"  ck="mod-system" type="checkbox">清理缓存</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="8"  ck="mod-system" type="checkbox">区域配送</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="15"  ck="mod-system" type="checkbox">管理员列表(管理员管理)</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="16"  ck="mod-system" type="checkbox">角色管理</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="17"  ck="mod-system" type="checkbox">管理员日志</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="18"  ck="mod-system" type="checkbox">供应商列表(供应商管理)</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="19"  ck="mod-system" type="checkbox">权限资源列表(权限资源管理)</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="20"  ck="mod-system" type="checkbox">模板设置</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="21"  ck="mod-system" type="checkbox">数据备份与恢复</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="24"  ck="mod-system" type="checkbox">库存日志</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="66"  ck="mod-system" type="checkbox">通用编辑</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="86"  ck="mod-system" type="checkbox">经营类目</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>会员中心</label>
								<input value="1" cka="mod-member" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="9"  ck="mod-member" type="checkbox">会员管理</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="10"  ck="mod-member" type="checkbox">会员等级</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="11"  ck="mod-member" type="checkbox">充值记录</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>商品中心</label>
								<input value="1" cka="mod-goods" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="22"  ck="mod-goods" type="checkbox">商品分类</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="23"  ck="mod-goods" type="checkbox">商品列表(商品管理)</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="25"  ck="mod-goods" type="checkbox">商品模型</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="26"  ck="mod-goods" type="checkbox">商品规格</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="27"  ck="mod-goods" type="checkbox">品牌列表(品牌管理)</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>店铺管理</label>
								<input value="1" cka="mod-store" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="28"  ck="mod-store" type="checkbox">店铺列表(店铺管理)</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="29"  ck="mod-store" type="checkbox">店铺等级</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="30"  ck="mod-store" type="checkbox">店铺分类</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="31"  ck="mod-store" type="checkbox">自营店铺</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="32"  ck="mod-store" type="checkbox">经营类目审核</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>订单中心</label>
								<input value="1" cka="mod-order" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="33"  ck="mod-order" type="checkbox">订单列表</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="34"  ck="mod-order" type="checkbox">虚拟订单</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="35"  ck="mod-order" type="checkbox">退款换货</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="36"  ck="mod-order" type="checkbox">订单日志</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="37"  ck="mod-order" type="checkbox">商品评论</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="38"  ck="mod-order" type="checkbox">商品咨询</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="39"  ck="mod-order" type="checkbox">投诉管理</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="40"  ck="mod-order" type="checkbox">举报管理</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>营销推广</label>
								<input value="1" cka="mod-marketing" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="41"  ck="mod-marketing" type="checkbox">抢购管理</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="42"  ck="mod-marketing" type="checkbox">团购管理</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="43"  ck="mod-marketing" type="checkbox">优惠促销</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="44"  ck="mod-marketing" type="checkbox">订单促销</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="45"  ck="mod-marketing" type="checkbox">店铺优惠券</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>分销管理</label>
								<input value="1" cka="mod-distribut" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="46"  ck="mod-distribut" type="checkbox">分销管理</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="47"  ck="mod-distribut" type="checkbox">分销关系</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="48"  ck="mod-distribut" type="checkbox">分成日志</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="52"  ck="mod-distribut" type="checkbox">图文回复</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>微信管理</label>
								<input value="1" cka="mod-weixin" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="49"  ck="mod-weixin" type="checkbox">公众号配置</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="50"  ck="mod-weixin" type="checkbox">微信菜单管理</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="51"  ck="mod-weixin" type="checkbox">文本回复</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>统计报表</label>
								<input value="1" cka="mod-count" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="53"  ck="mod-count" type="checkbox">销售概况</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="54"  ck="mod-count" type="checkbox">销售排行</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="55"  ck="mod-count" type="checkbox">会员排行</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="56"  ck="mod-count" type="checkbox">销售明细</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="57"  ck="mod-count" type="checkbox">会员统计</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="58"  ck="mod-count" type="checkbox">运营概况</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>插件工具</label>
								<input value="1" cka="mod-tools" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="59"  ck="mod-tools" type="checkbox">插件管理</label>
									</li>
															</ul>
						</div>
											<div class="ncap-account-container" style="border-top:none;">
							<h4>
								<label>运营</label>
								<input value="1" cka="mod-maintenance" type="checkbox">
								<label>全部</label>
							</h4>
							<ul class="ncap-account-container-list">
																	<li>
										<label><input class="checkbox" name="right[]" value="60"  ck="mod-maintenance" type="checkbox">商家提现申请</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="61"  ck="mod-maintenance" type="checkbox">商家转款列表</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="62"  ck="mod-maintenance" type="checkbox">会员提现申请</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="63"  ck="mod-maintenance" type="checkbox">会员转款列表</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="64"  ck="mod-maintenance" type="checkbox">商家结算记录</label>
									</li>
																	<li>
										<label><input class="checkbox" name="right[]" value="65"  ck="mod-maintenance" type="checkbox">平台支出记录</label>
									</li>
															</ul>
						</div>
									</dd>
			</dl>

			<div class="bot"><a href="JavaScript:void(0);" onclick="roleSubmit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
		</div>
	</form>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		$(":checkbox[cka]").click(function(){
			var $cks = $(":checkbox[ck='"+$(this).attr("cka")+"']");
			if($(this).is(':checked')){
				$cks.each(function(){$(this).prop("checked",true);});
			}else{
				$cks.each(function(){$(this).removeAttr('checked');});
			}
		});
	});

	function choosebox(o){
		var vt = $(o).is(':checked');
		if(vt){
			$('input[type=checkbox]').prop('checked',vt);
		}else{
			$('input[type=checkbox]').removeAttr('checked');
		}
	}

	function roleSubmit(){
		if($('#role_name').val() == '' ){
			layer.alert('角色名称不能为空', {icon: 2});
			return false;
		}
		$('#roleform').submit();
	}
</script>
</body>
</html>